package com.bestcem.xm.wallet.util.convert;

import com.bestcem.xm.wallet.controller.vo.request.RechargeOrderCallbackVO;
import com.bestcem.xm.wallet.controller.vo.request.WalletRechargeRequestVO;
import com.bestcem.xm.wallet.controller.vo.response.RechargeInfoVO;
import com.bestcem.xm.wallet.controller.vo.response.WalletLimitRechargeVO;
import com.bestcem.xm.wallet.controller.vo.response.WalletRechargeVO;
import com.bestcem.xm.wallet.entity.mysql.LimitOrder;
import com.bestcem.xm.wallet.entity.pojo.LimitOrderDO;
import com.bestcem.xm.wallet.grpc.client.dto.RechargeMiniProgramDTO;
import com.bestcem.xm.wallet.grpc.client.dto.WalletRechargeDTO;
import com.bestcem.xm.wallet.service.dto.LimitOrderDTO;
import com.bestcem.xm.wallet.service.dto.MiniProgramPayDTO;
import com.bestcem.xm.wallet.service.dto.WalletRechargeInfoDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 限制充值订单转换类
 *
 * @author wangyunyun <jishuo.yan@idiaoyan.com>
 * @version v1.0
 * @date 2022/5/13 11:04
 */
@Mapper(componentModel = "spring")
public interface LimitOrderConvert {

    LimitOrderDO dto2Do(LimitOrderDTO limitOrderDTO);

    List<LimitOrderDTO> dos2Dtos(List<LimitOrderDO> limitOrderDOList);

    LimitOrder do2Mysql(LimitOrderDO limitOrderDO);

    List<LimitOrderDO> mysqls2Dos(List<LimitOrder> selectBySelective);

    WalletRechargeDTO walletRechargeVo2Dto(WalletRechargeRequestVO vo);

    WalletRechargeVO walletRechargeInfoDto2Vo(WalletRechargeInfoDTO walletRechargeInfoDTO);

    /**
     * DTO转化方法
     * @param param RechargeMiniProgramDTO
     * @return MiniProgramPayDTO
     */
    MiniProgramPayDTO convert(RechargeMiniProgramDTO param);

    /**
     * DTO转化方法
     * @param param MiniProgramPayDTO
     * @return WalletLimitRechargeVO
     */
    WalletLimitRechargeVO convert(MiniProgramPayDTO param);

    @Mappings({
            @Mapping(target = "id", source = "limitOrderId"),
            @Mapping(target = "msg", source = "content"),
    })
    RechargeInfoVO dto2RechargeInfoVo(LimitOrderDTO data);

    @Mappings({
            @Mapping(target = "walletOrderId", source = "orderId"),
    })
    LimitOrderDTO rechargeOrderCallbackVo2Dto(RechargeOrderCallbackVO orderCallbackVO);
}
